package com.zxd.dao;

import com.zxd.entity.Group;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * GroupDao
 * Created by 涂奕恒 on 2019/5/6 0006 下午 12:00.
 */
public interface GroupDao extends JpaRepository<Group, Integer>, JpaSpecificationExecutor<Group> {

    @Query("select a from Group a where a.name = ?1 and a.parentId = ?2")
    Group paramsByNameAndParentId(String name, Integer parentId);

    @Query("select a from Group a where a.parentId = ?1")
    List<Group> findListByParentId(Integer parentId);
}